<?php
namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Model\GrasslandSheep;
use App\Model\OperationLogs;

class GrasslandSheepController extends BaseController
{
    protected $model = null;

    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->model = new GrasslandSheep();
    }

    //森林狩猎配置获取
    public function grasslandSheepGetConfig(Request $request){
        $res = $this->model->grasslandSheepGetConfig($request->all());
        return $this->toJson($res['code'], $res['data'], $res['msg']);
    }

    //森林狩猎配置修改
    public function grasslandSheepUpdateConfig(Request $request){
        $res = $this->model->grasslandSheepUpdateConfig($request->all());
        if($res['code'] == self::SUCCESS) {
            OperationLogs::createData($request, OperationLogs::ACTIVITY, '森林狩猎配置修改');
        }
        return $this->toJson($res['code'], $res['data'], $res['msg']);
    }

    //森林狩猎押注池修改
    public function grasslandSheepUpdateTrackpool(Request $request){
        $res = $this->model->grasslandSheepUpdateTrackpool($request->all(), $this->user);
        if($res['code'] == self::SUCCESS) {
            OperationLogs::createData($request, OperationLogs::ACTIVITY, '森林狩猎押注池修改');
        }
        return $this->toJson($res['code'], $res['data'], $res['msg']);
    }

    //森林狩猎押注池修改记录列表
    public function grasslandSheepTrackpoolList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->grasslandSheepTrackpoolList($request));
    }

    //森林狩猎整体数据V3
    public function statSearchAllV3(Request $request){
        $res = $this->model->statSearchAllV3($request);
        return $this->toJson($res['code'], $res['data'], $res['msg']);
    }

    //森林狩猎单期数据V3
    public function statGameEveryV3(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->statGameEveryV3($request));
    }

    //森林狩猎用户参与明细V3
    public function statUserInfoV3(Request $request){
        $res = $this->model->statUserInfoV3($request);
        return $this->toJson($res['code'], $res['data'], $res['msg']);
    }

}
